package com.yet.kotlinapp.modules.regist

import android.os.Bundle
import com.blankj.utilcode.util.ToastUtils
import com.qmuiteam.qmui.arch.QMUIActivity
import com.qmuiteam.qmui.arch.QMUIFragmentActivity
import com.yet.kotlinapp.databinding.RegistActivityBinding
import com.yet.kotlinapp.modules.regist.inter.RegistView

/**
 *
 * @ProjectName: Kotlin app
 * @Package: com.yet.kotlinapp.modules.regist
 * @ClassName: RegisterActivity
 * @Description: java类作用描述
 * @Author: liys
 * @CreateDate: 2021/8/30 9:42
 * @UpdateUser: 更新者
 * @UpdateDate: 2021/8/30 9:42
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
    class RegisterActivity: QMUIFragmentActivity(),RegistView {

    lateinit var acview :RegistActivityBinding;
    lateinit var registP:RegistPresentImp

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        acview= RegistActivityBinding.inflate(layoutInflater)
        var rootview = acview.root
        setContentView(rootview)
        registP= RegistPresentImp(this)
        var toolbar=acview.barTitle
        toolbar.setTitle("注册")
        toolbar.addLeftBackImageButton().setOnClickListener {
                popBackStack()
        }
        acview.btRegist.setOnClickListener {
            var user:String=acview.edUser.text.toString()
            var pw:String=acview.edPw.text.toString()
            var pw2:String=acview.edPw2.text.toString()
            registP.registAction(user,pw,pw2)
        }
    }

    override fun onSuccess() {
        ToastUtils.showLong("注册成功")
        popBackStack()
    }

    override fun onFail(error: String) {
        ToastUtils.showLong(error)
    }



}